using System.Collections;
using System.Collections.Generic;
using Unity.VisualScripting;
using UnityEngine;
using UnityEngine.SceneManagement;


public class NiuPaiGame : MonoBehaviour
{
    public Camera MainCamera = null;
    public Animation _ani = null;

    public GameObject Hand = null;
    void Start()
    {
        _ani.Play("Down");
        if (!AdManager.Instance.ShieldAddress)
        {
            CheckTouch.Show(this.MainCamera.transform.Find("Canvas").transform);
        }
        else
        {

        }
    }

    void Update()
    {

    }
    Ray ray;
    //界面按下
    public void OnClick()
    {
        ray = MainCamera.ScreenPointToRay(Input.mousePosition);
        RaycastHit hit;
        if (Physics.Raycast(ray, out hit, Mathf.Infinity))
        {
            Debug.Log(hit.collider.name);
            //射线debug
            // Debug.DrawLine(this.MainCamera.transform.position, hit.collider.transform.position, Color.red);
            Set_Animation(hit.collider.name);
        }

    }

    //改变动画
    void Set_Animation(string AniName)
    {
        switch (AniName)
        {
            case "眨眼": _ani.Play("ZhaYan"); break;
            case "转眼球": _ani.Play("ZhuanYanQiu"); break;
            case "按摩": _ani.Play("AnMo"); break;
            case "舔右边": _ani.Play("TianYouBian"); break;
            case "舔左边": _ani.Play("TianZuoBian"); break;
            case "吐舌头": _ani.Play("TuSheTou"); break;
            case "吃东西": _ani.Play("TuYaChi"); break;
        }
        Hand.SetActive(false);

    }

    //返回主页  
    public void ReStart()
    {
        SceneManager.LoadScene("Start");
    }
    //播放原神
    public void shownative()
    {
        AdManager.Instance.ShowNative();
    }
}
